// 机器信息类型
export interface Machine {
  id: number;
  name: string;
  ip: string;
  status: 'online' | 'offline' | 'warning';
  cpu: number;
  memory: number;
  disk: number;
  os: string;
  purpose: string;
  owner: string;
  location?: string;
  uptime?: string;
  lastReboot?: string;
  processes?: Process[];
  is_activate?: boolean;
}

// 进程类型
export interface Process {
  pid: number;
  name: string;
  cpu: number;
  memory: number;
  user: string;
  status: string;
  port: string;
}

// 数据库类型
export interface Database {
  id: number;
  name: string;
  host: string;
  port?: number;
  type?: string;
  status?: 'running' | 'stopped' | 'error' | 'normal' | 'warning';
  connections?: number;
  size?: string;
  qps?: number;
  uptime?: string;
}

// 告警类型
export interface Alarm {
  id: number;
  time: string;
  level: 'critical' | 'warning' | 'info';
  source: string;
  message: string;
  status: 'pending' | 'resolved' | 'ignored' | 'active';
  type?: string;
  serverName?: string;
  serverIP?: string;
  firstTime?: string;
  duration?: string;
}

// 用户信息类型
export interface UserInfo {
  id?: number;
  username: string;
  name?: string;
  email?: string;
  role?: 'admin' | 'user';
  avatar?: string;
}

// API响应类型
export interface ApiResponse<T> {
  success: boolean;
  data?: T;
  message?: string;
  timestamp?: string;
}

// 登录响应类型
export interface LoginResponse {
  token: string;
  user: UserInfo;
  expiresIn: number;
}

// 分页参数类型
export interface PaginationProps {
  currentPage: number;
  totalPages: number;
  pageSize: number;
  totalItems: number;
  onPageChange: (page: number) => void;
  onPageSizeChange: (size: number) => void;
}

// 排序配置类型
export interface SortConfig {
  key: string | null;
  direction: 'asc' | 'desc';
}

// Agent配置类型
export interface AgentConfig {
  machine_id: number;
  interval: number;
  collect_system_info: boolean;
  collect_cpu_info: boolean;
  collect_memory_info: boolean;
  collect_disk_info: boolean;
  collect_network_info: boolean;
  collect_process_info: boolean;
  collect_log_info: boolean;
  collect_database_info: boolean;
  log_paths: string[];
  database_configs: any[];
  port_list: number[];
  process_names?: string[]; // 添加进程名称列表属性
}